﻿using System;
using System.Linq;
using System.Reflection;
using ClosedXML.Excel;
using SuppKids.Core.Reporting.Data;

namespace SuppKids.Core.Reporting.Excel
{
    public class MoveProductsReportGenerator : ExcelReportGenerator
    {
		protected override void CreateWorkbook(out XLWorkbook workbook, out IXLWorksheet worksheet)
		{
            workbook = new XLWorkbook(Assembly.GetExecutingAssembly().GetManifestResourceStream("SuppKids.Core.Reporting.Excel.Templates.MoveProductsReport.xlsx"));
			worksheet = workbook.Worksheets.FirstOrDefault() ?? workbook.Worksheets.Add(workbook.Worksheets.Count.ToString(this.FormatProvider));
		}
        protected override void CreateContent(IXLWorksheet worksheet, IReportData reportData)
        {
            //todo Bind product names
            //var data = reportData as MoveProductsReportData;
            //if (data == null)
            //{
            //    throw new InvalidOperationException("Report data is not valid for this kind of report.");
            //}

            //worksheet.Style.Font.FontName = "Arial";
            //worksheet.Style.Font.FontSize = 10;
            //worksheet.Style.Font.Bold = false;

            
            //var i = 1;
            //foreach (var product in data.Products)
            //{
            //    worksheet.Cell("A" + i).Value = product.Name;
            //}
        }
    }
}